#include "StdAfx.h"
#include "HRTimer.h"

namespace dhis
{


double CHRTimer::LIToSecs( LARGE_INTEGER & L) {
	return ((double)L.QuadPart /(double)frequency.QuadPart);
}

CHRTimer::CHRTimer(){
	timer.start.QuadPart=0;
	timer.stop.QuadPart=0;	
	QueryPerformanceFrequency( &frequency );
}

void CHRTimer::startTimer( ) {
	QueryPerformanceCounter(&timer.start);
}

void CHRTimer::stopTimer( ) {
	QueryPerformanceCounter(&timer.stop);
}


double CHRTimer::getElapsedTime() {
	LARGE_INTEGER time;
	time.QuadPart = timer.stop.QuadPart - timer.start.QuadPart;
	return LIToSecs( time) ;
}
}